package cn.wolfcode.trip.base.service.impl;

import cn.wolfcode.trip.base.domain.Reply;
import cn.wolfcode.trip.base.mapper.ReplyMapper;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IReplyService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ReplyServiceImpl implements IReplyService {
    @Autowired
    private ReplyMapper replyMapper;

    @Override
    public Reply saveOrUpdate(Reply entity) {
        if (entity.getId() != null){
            replyMapper.updateByPrimaryKey(entity);
        }else {
            entity.setTime(new Date());
            replyMapper.insert(entity);
        }
        return entity;
    }
}
